package Thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Demo12 {
    public static void main(String[] args) {
       //ExecutorService executorService = Executors.newCachedThreadPool();
        ExecutorService executorService=Executors.newFixedThreadPool(5);
        for (int i = 0; i < 1000; i++) {
           final int id=i;
            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    String name=Thread.currentThread().getName();
                    System.out.println("hello"+name+","+id);
                }
            });
        }
    }
}
